package com.frejoys.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.ReasonAddDto;
import com.frejoys.common.dto.admin.ReasonListDto;
import com.frejoys.common.dto.admin.ReasonUpDto;
import com.frejoys.dao.entity.Reason;

import java.util.List;
import java.util.Map;

public interface ReasonService extends IService<Reason> {


    default Reason getOnly(QueryWrapper<Reason> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default Reason getOnly(LambdaQueryWrapper<Reason> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }


    /**
     * 获取信息
     * @param id
     * @return
     */
    Reason getInfo(Integer id);



    boolean addInfo(ReasonAddDto reasonAddDto);



    boolean upInfo(ReasonUpDto dto);


    /**
     * 管理端获取驳回原因列表
     */
    List<Reason> listInfo(ReasonListDto dto);

    /**
     * app获取驳回原因列表
     */
    List<Reason> listInfo(Integer type);

    /**
     * 获取id与原因map
     */
    Map<Integer, String> getIdNameMap(List<Integer> ids);


}
